<?php  
/* 
Template Name: Page Tuyen Dung
*/
?>
<?php get_header(); ?>
<div class="cy-left">
<?php get_sidebar();?>
</div><!--cy-left-->
   <div class="cy-center">
   <div class="cy-center-title"><span>	 
   			<?php if($_GET['lang']=='en'){?>
                Contact
            <?php }else{?>
            	Liên hệ
                
            <?php }?> </span></div>
   <div class="cy-center-ct">
 		<?php
		
		$paged = (get_query_var('page')) ? get_query_var('page') : 1;	
		//query_posts('meta_key=_mf_write_panel_id&meta_value=1&');
		$loop = new WP_Query(array('post_type'=>'tuyen_dung','orderby'=>'ASC','page' => $paged));
						?>
        			<?php while ( $loop->have_posts() ) : $loop->the_post(); //bat dau vong lap ?>
                    		<div class="doitac-item">
								<p class="title-doitac"><?php the_title()?></p>
                                    <img src="<?php 
                                   echo get('hinh_tuyen_dung');
                                    ?>" width="150" height="100"/> 
                                 <div class="doitac-ct">
										<?
										$content = get_the_excerpt();
										echo substr($content, 0, 300);
										?>
								</div><!--doitac-ct-->
                                <a href="<?php the_permalink(); ?>"><?php if($_GET['lang']=='en'){?>
                                    Detail
                                <?php }else{?>
                                    Chi tiết
                                <?php }?> </a>
                            </div><!--doitac-item-->
                	<?php endwhile; //ket thuc vong lap ?>
                    <?php wp_reset_query();?>
        <center>
        <div class="cy-pagination">
<?php // OK, custom tax's dont work nice with query_posts (i think) but they DEF dont work nice with next_posts(), previous_posts() and  posts_nav_link()
              // SO, got the custom page nav from here:
              // http://wordpress.org/support/topic/adding-pagination-to-a-wp_query-loop?replies=16
        if($loop->max_num_pages>1){
          if ($paged > 1) { ?>
            <a href="<?php echo '../theme_web500k_vn/?page_id='.get_query_var('page_id').'page=' . ($paged -1); //prev link ?>">«</a>
          <?php
          }
          for($i=1;$i<=$loop->max_num_pages;$i++){?>
          	<?php if($i==$paged){?>
            <span><?php echo $i;?></span>
			<?php } else {?>
            <a href="<?php echo '../theme_web500k_vn/?page_id='.get_query_var('page_id').'&page=' . $i; ?>" <?php echo ($paged==$i)? 'class="selected"':'';?>><?php echo $i;?></a>
          <?php
			}//end if
          } //end for
          if($paged < $loop->max_num_pages){?>
            <a href="<?php echo '../theme_web500k_vn/?page_id='.get_query_var('page_id').'page=' . ($paged + 1); //next link ?>">»</a>
          <?php
          }
        }?>
        </div><!--cy-pagination-->
		</center>         
    </div><!--cy-center-ct-->   
   </div><!--cy-left-->
   <div class="cy-right">
   <?php get_sidebar();?>
   </div><!--cy-right-->
<?php get_footer(); ?>